package beveragecase;

import beveragecase.beverage.Espresso;
import beveragecase.condiment.Mocha;
import beveragecase.condiment.Soy;
import beveragecase.condiment.Whip;

/**
 * description:
 *  装饰者模式饮料订单机
 * @author yuanmenglv on 2019/11/27
 */
public class Client {
    public static void main(String[] args) {
        //点一杯Espresso
        BaseBeverage espresso = new Espresso();
        //不加任何调料
        System.out.println("来一杯不加任何东西的Espresso：" + espresso.getDescription() + "，价格为：" + espresso.cost());


        //来一个Espresso，各种配料都加一份，Mocha加两份
        espresso = new Mocha(espresso);
        espresso = new Mocha(espresso);
        espresso = new Whip(espresso);
        espresso = new Soy(espresso);
        System.out.printf("两份Mocha，其余所有调料各一份的Espresso：" + espresso.getDescription() + "，价格为：%.2f\n" , espresso.cost());
    }
}
